<template>
  <el-container>
    <el-header>
      <div class="left">电商后台管理系统</div>
      <button
        class="btn"
        @click="handleLogout"
      >退出</button>

    </el-header>
    <el-container>
      <side-bar />
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import SideBar from "./components/SideBar";
export default {
  data() {
    return {};
  },
  components: {
    SideBar,
  },
  methods: {
    handleLogout() {
      window.localStorage.removeItem("token");
      this.$router.push("/login");
    },
  },
};
</script>

<style lang="less" scoped>
.el-container {
  height: 100%;

  .el-header {
    background: #373d41;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    .left {
      font-size: 20px;
    }
    .btn {
      background: #ddd;
      border-radius: 4px;
      padding: 8px 16px;
      border: none;
      font-size: 16px;
      color: #666;
      cursor: pointer;
      &:hover {
        background: #eee;
      }
    }
  }

  .el-main {
    background: #eaedf1;
  }
}
</style>